<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">
    <f:view contentType="text/html">
        <h:head>
            <f:facet name="first">
                <meta content='text/html; charset=UTF-8' http-equiv="Content-Type"/>
                <title>#{tekster.Velg_op}</title>
            </f:facet>
        </h:head>
        <h:form>
            <h:body>
                <ui:composition template="../templates/template.xhtml">
                    <ui:define name="content">
                        <p:growl globalOnly="true" sticky="false" id="growl"/>

                        <h3>Oppgave #{reg.oid}.</h3>

                        <br/>
                        <h3>#{tekster.Velg_op}</h3>
                        <p:inputText  id ="operator" validatorMessage="validator mess" required="true" maxlength="1" requiredMessage="Skriv en operator! +, -, / eller *)" value ="#{reg.oppg.operator}">
                            <f:validateRegex pattern="((?=.*[/,*,+,-]).{1,1})" id="asdfghjk" />
                        </p:inputText>

                        <h:message for="operator" style="color: red;"/>
                        <h:message for="asdfghjk" />

                        <h3>#{tekster.OO_tekst} 
                            <h:outputText value="&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;" />   
                            #{tekster.OO_hint}</h3>

                        <p:inputTextarea id="oppgave" rows="3" cols="40" value="#{reg.oppg.oppgave}" required="true" requiredMessage=" Skriv en oppgave!"/> 
                        <h:message for ="oppgave" style="color: red;"/>

                        <h:outputText value="&#160; &#160; &#160; &#160;" />

                        <p:inputTextarea id="hint" rows="3" cols="40"  value="#{reg.oppg.hint}" />
                        <h:message for="hint" style="color: red;"/>
                        <br/>
                        <br/>
                        <h3>#{tekster.OO_svar}</h3>   

                        <p:inputText id ="svar" type="number" required="true" maxlength="4" converterMessage="Skriv kun tall" value="#{reg.oppg.svar}">
                            <f:convertNumber integerOnly="true"  > </f:convertNumber>
                        </p:inputText>
                        <h:message for="svar" style="color: red;"/>
                        <p:commandButton update="growl" ajax="false" value="Sjekk svar" actionListener="#{reg.regneRegne(ev)}"/>

                        <br/><br/><br/><br/>

                        <p:commandButton update="growl" actionListener="#{reg.lagOppgave(e)}" ajax ="false" value="#{tekster.OO_fullf}"/>
                        <p:commandButton ajax="false" value="#{tekster.OO_forrige}"/>
                        <p:commandButton ajax="false" value="#{tekster.OO_ferdig}" action="/Ansatt/opprettOppgsett.xhtml"/>

                    </ui:define>
                    <ui:define name ="left">
                        <div align="center">
                            <h:commandLink action="/index?faces-redirect=true" immediate="true">
                                <h:graphicImage library="images" name="home.png"/>
                            </h:commandLink><br/><br/>
                            <p:commandButton ajax="false" action="/Ansatt/ansatt?faces-redirect=true" value="#{tekster.Tilbake_ansatt}" immediate="true" />
                            <p:commandButton ajax="false" action="/Ansatt/redigerOppgave.xhtml" value="#{tekster.Red_oppg}" immediate="true" />
                        </div>

                    </ui:define>
                </ui:composition>
            </h:body>
        </h:form>
    </f:view>
</html>
